package com.trkj.dao;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.trkj.pojo.Menurole;

/**
 * 菜单角色DAO
 * @author 吴山峰
 * 
 */
@Repository
public interface MenuroleDAO extends JpaRepository<Menurole, Long>,JpaSpecificationExecutor<Menurole>{

	public  Menurole findByRoleId(Integer id);
	
	@Query(nativeQuery = true, value = "SELECT m.role_id, m.role_name,(SELECT 1 FROM `roe-user` u WHERE u.role_id = m.role_id and u.emp_id=? ) v FROM menurole m WHERE m.role_state = 1")
	public List<Object[]> findEmpRole(Integer empid);
}
